using FPLibrary;

namespace Pvp.Ecs
{
    /// <summary>
    /// unit 移动
    /// </summary>
    public class UnitMoveSystem : ISystem
    {
        public override void OnStart()
        {
        }

        public override void OnFrameExecute(int frameIndex)
        {
            var units = Entities.GetComponents<IMove>();
            foreach (var unit in units)
            {
                if (unit.TryGetCombineComponent<IUnit>(out var x))
                {
                    var tmp =unit.Forward * unit.MoveSpeed;
                    x.Position += new FPVector(tmp.x, 0, tmp.y);
                }
            }
        }
        
        private  void a1()
        {}
        
        private void a2()
        {}
    }
}